﻿using System;
using DMS.BaseClass;
using DMS.Business.Utility;

namespace DMS.Web.Modules.ArchivesManagement
{
    public partial class GRBaseInfoForm : System.Web.UI.Page
    {
        private string _id = "";
        private ActionType _action;


        protected void Page_Load(object sender, EventArgs e)
        {
            //_id = Request["id"];
            //_action = (ActionType)Enum.Parse(typeof(ActionType), Request["action"].ToString());

            if (!IsPostBack)
            {
                //InitControls();
                //InitData();
            }
        }

        private void InitControls()
        {
           
        }

        private void InitData()
        {
            
        }


        protected void btnSave_Click(object sender, EventArgs e)
        {
            //if (!Page.IsValid)
            //{
            //    return;
            //}

            //try
            //{
            //    SYS_OfficePoint point;
            //    OfficePointService service = new OfficePointService();
            //    if (_action == ActionType.New)
            //    {
            //        point = new SYS_OfficePoint();
            //        point.PointID = Guid.NewGuid().ToString();
            //    }
            //    else
            //    {
            //        point = service.GetOfficePointByID(_id);
            //    }
            //    FormBinder.BindControlsToObject(point, divContent);
                

            //    if (_action == ActionType.New)
            //    {
            //        service.Add(point);
            //    }
            //    else
            //    {
            //        service.Update();
            //    }

                ClientHelper.Instance.CloseWindow("保存成功", "ok", RefreshType.OpenDialog);
            //}
            //catch (Exception ex)
            //{
            //    string code = LogHelper.LogException(ex);
            //    string msg = string.Format("操作失败，请联系管理员。\\r\\n错误码：{0}", code);
            //    ClientHelper.Instance.Alert(msg);
            //}
        }

        protected void ProvinceID_SelectedIndexChanged(object sender, EventArgs e)
        {
            //List<SYS_Address_City> list = AddressService.GetCitysByProvinceId(ProvinceID.SelectedValue);
            //CityID.DataSource = list;
            //CityID.DataBind();

            //foreach (ListItem item in CityID.Items)
            //{
            //    if (item.Text == "广州市")
            //    {
            //        item.Selected = true;
            //        CityID_SelectedIndexChanged(null, null);
            //        break;
            //    }
            //}
        }

        protected void CityID_SelectedIndexChanged(object sender, EventArgs e)
        {
            //List<SYS_Address_District> list = AddressService.GetDistrictsByCityId(CityID.SelectedValue);
            //DistrictID.DataSource = list;
            //DistrictID.DataBind();
        }
    }
}